<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <title>Conduit</title>
  <!-- Import Ionicon icons & Google Fonts our Bootstrap theme relies on -->
  <link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="preload" as="style">
  <link href="//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css">
  <link
    href="//fonts.googleapis.com/css?family=Titillium+Web:700|Source+Serif+Pro:400,700|Merriweather+Sans:400,700|Source+Sans+Pro:400,300,600,700,300italic,400italic,600italic,700italic?display=swap"
    rel="stylesheet" type="text/css">
  <!-- Import the custom Bootstrap 4 theme from our hosted CDN -->
  <link href="//demo.productionready.io/main.css" rel="preload" as="style">
  <link rel="stylesheet" href="//demo.productionready.io/main.css">
</head>
{{-- 网站布局 --}}
<body>

  <nav class="navbar navbar-light">
    <div class="container">
      {{-- 首页 --}}
      <a class="navbar-brand" href="{{ route('/') }}">conduit</a>
      {{-- 子菜单，面包屑菜单 --}}
      <ul class="nav navbar-nav pull-xs-right">
        <li class="nav-item">
          <!-- Add "active" class when you're on that page" -->
          @navLink({ path: route('/') })
          Home
          @end
        </li>

        {{-- 如果用户一登录则显示发表文章，设置，个人资料按钮 --}}
        @if(auth.isLoggedIn)
        @set('currentProfile', await auth.user.related('profile').query().first())
        <li class="nav-item">
          @navLink({ path: route('editor') })
          <i class="ion-compose"></i>&nbsp;New Article
          @end
        </li>
        <li class="nav-item">
          @navLink({ path: route('settings') })
          <i class="ion-gear-a"></i>&nbsp;Settings
          @end
        </li>
        <li class="nav-item">
          <a class="nav-link" href="{{ route('profiles.show', currentProfile) }}">
            {{ currentProfile.name }}
          </a>
        </li>
        @else
        {{-- 否则显示登录和注册按钮 --}}
        <li class="nav-item">
          @navLink({ path: route('login') })
          Sign in
          @end
        </li>
        <li class="nav-item">
          @navLink({ path: route('register') })
          Sign up
          @end
        </li>
        @endif
      </ul>
    </div>
  </nav>

  {{-- 内容板块 --}}
  @!section('body')

  {{-- 结束部分布局 --}}
  <footer>
    <div class="container">
      <a href="/" class="logo-font">conduit</a>
      <span class="attribution">
        An interactive learning project from <a href="https://thinkster.io">Thinkster</a>. Code &amp; design licensed
        under MIT.
      </span>
    </div>
  </footer>

</body>

</html>
